﻿#region copyright
//<copyright>
// Copyright(C) 2012 TrackerRealm Corporation
// This file is part of the open source project - Jazz. http://jazz.codeplex.com
// 
// Jazz is open software: you can redistribute it and/or modify it 
// under the terms of the GNU Affero General Public License (AGPL) as published by 
// the Free Software Foundation, version 3 of the License.
// 
// Jazz is distributed in the hope that it will be useful, 
// but WITHOUT ANY WARRANTY; without even the implied warranty 
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
//  See the GNU Affero General Public License (AGPL) for more details.
// 
// You should have received a copy of the GNU General Public 
// License along with Jazz.  If not, see <http://www.gnu.org/licenses/>.
//
// REMOVAL OF THIS NOTICE IS VIOLATION OF THE COPYRIGHT. 
//</copyright>
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Reflection;
using TrackerRealm.Jazz.Common;
using TrackerRealm.Jazz.Client;
using C = TrackerRealm.Jazz.Common.JazzConstants;

namespace TrackerRealm.Jazz.Client.Custom
{
    /// <summary>
    /// 
    /// </summary>
    public class ClientNexus: ClientNexusGeneric<jProfile, jUser, jRole, jWorkspace>  
    {
        #region Factory Methods - Create
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static ClientNexus Create()
        {
            return new ClientNexus(NexusConfig.DefaultSettings());
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="nexusStart"></param>
        /// <returns></returns>
        public static ClientNexus Create(NexusConfig nexusStart)
        {
            return new ClientNexus(nexusStart);
        }
        #endregion
        #region Constructor
        /// <summary>
        /// 
        /// </summary>
        /// <param name="nexusConfig"></param>
        internal ClientNexus(NexusConfig nexusConfig)
        :base(nexusConfig)
        {
        }
        #endregion
    }
    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="P"></typeparam>
    /// <typeparam name="U"></typeparam>
    /// <typeparam name="R"></typeparam>
    /// <typeparam name="W"></typeparam>
    public class ClientNexusGeneric<P, U, R, W> : ClientNexusBase 
        where P: jProfileBase
        where U : jUserBase
        where R : jRoleBase
        where W : jWorkspaceBase
    {
        #region Constructor
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="nexusConfig"></param>
        protected ClientNexusGeneric(NexusConfig nexusConfig)
            : base(nexusConfig)
        {
        }
        #endregion
        #region LoginProfile
        /// <summary>
        /// 
        /// </summary>
        public P LoginProfile
        {
            get { return (P)base._LoginProfile; }
        }
        #endregion
        #region LoginRoles
        /// <summary>
        /// 
        /// </summary>
        public IEnumerable<R> LoginRoles
        {
            get { return base._LoginRoles.Cast<R>(); }
        }
        #endregion
        #region PublicWorkspace
        /// <summary>
        /// 
        /// </summary>
        public W PublicWorkspace
        {
            get { return (W)base._PublicWorkspace; }
        }
        #endregion
    }
    
}
